Except for the first two terms, each term of the sequence $1000, x, 1000 - x,\ldots$ is obtained by subtracting the preceding term from the one before that. The last term of the sequence is the first negative term encountered. What positive integer $x$ produces a sequence of maximum length?
Solution: Let the terms of the sequence be $a_1,$ $a_2,$ $a_3,$ $\dots.$  Then
\begin{align*}
a_1 &= 1000, \\
a_2 &= x, \\
a_3 &= 1000 - x, \\
a_4 &= 2x - 1000, \\
a_5 &= 2000 - 3x, \\
a_6 &= 5x - 3000, \\
a_7 &= 5000 - 8x, \\
a_8 &= 13x - 8000, \\
a_9 &= 13000 - 21x, \\
a_{10} &= 34x - 21000, \\
a_{11} &= 34000 - 55x.
\end{align*}If the sequence reaches 12 terms, then we must have $34000 - 55x > 0$ and $34x - 21000 > 0,$ or
\[\frac{21000}{34} < x < \frac{34000}{55}.\]The only integer in this interval is $\boxed{618}.$